package auth

import (
	"github.com/dgrijalva/jwt-go"
)

var (
	ErrInvalidToken = jwt.NewValidationError("invalid token", jwt.ValidationErrorMalformed)
)

type Claims struct {
	IsAdmin bool `json:"is_admin"`
	jwt.StandardClaims
}

type TokenInfo struct {
	AccessToken string `json:"access_token"`
	ExpiresAt   int64  `json:"expires_at"`
}

type Auther interface {
	GenerateToken(userId string, isAdmin bool) (*TokenInfo, error)
	DestroyToken(accessToken string) error
	ParseUserID(tokenString string) (string, error)
	ParseToken(accessToken string) (*Claims, error)
	Release() error
}
